﻿Imports System.Text
Imports Tohto.Base.CommonConst
Imports Tohto.Base.Entity
Imports Tohto.Base.DBUtility
Imports Tohto.Base.ComUtility
Imports Oracle.DataAccess.Client

Public Class KJ0020B03

    Public Function GET_MITUMORI_NO(ByVal loginId As String, ByVal kojiNo As String, ByRef errInfo As PLSQLErrorInfo) As Integer
        Dim strCmdText As String
        strCmdText = "PG_KJ0020.GET_MITUMORI_NO"

        Dim parameters(3) As OracleParameter

        Dim I_VC_LOGINID As New OracleParameter("I_VC_LOGINID", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_LOGINID.Value = loginId

        Dim I_VC_KOJI_NO As New OracleParameter("I_VC_KOJI_NO", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_KOJI_NO.Value = kojiNo

        Dim O_CU_ERR As New OracleParameter("O_CU_ERR", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_STATS As New OracleParameter("O_STATS", OracleDbType.Int32, ParameterDirection.ReturnValue)

        parameters(0) = I_VC_LOGINID
        parameters(1) = I_VC_KOJI_NO
        parameters(2) = O_CU_ERR
        parameters(3) = O_STATS

        Dim hasOut As New Hashtable

        OracleHelp.ExecuteNonQuery(OracleHelp.ConnectionStringLocalTransaction,
                                           CommandType.StoredProcedure,
                                           strCmdText,
                                           hasOut,
                                           parameters)


        Return Util.ObjToInteger(hasOut("O_STATS"))
    End Function

    ''' <summary>
    ''' 税率を取得する
    ''' </summary>
    ''' <param name="dtDate">消費税開始日</param>
    ''' <returns>税率</returns>
    ''' <remarks></remarks>
    Public Function GET_TAX_RATE(ByVal dtDate As Date) As Decimal

        Dim strCmdText As String
        strCmdText = "PG_CM.GET_TAX_RATE"

        Dim parameters(1) As OracleParameter

        Dim I_DT_DATE As New OracleParameter("I_DT_DATE", OracleDbType.Date, ParameterDirection.Input)
        I_DT_DATE.Value = dtDate

        Dim O_STATS As New OracleParameter("O_STATS", OracleDbType.Decimal, ParameterDirection.ReturnValue)

        parameters(0) = I_DT_DATE
        parameters(1) = O_STATS

        Dim hasOut As New Hashtable

        OracleHelp.ExecuteNonQuery(OracleHelp.ConnectionStringLocalTransaction,
                                   CommandType.StoredProcedure,
                                   strCmdText,
                                   hasOut,
                                   parameters)

        Dim decTex As Decimal = 0
        If hasOut.Count > 0 Then
            decTex = Util.ObjToDecimal(hasOut("O_STATS"))
        End If

        Return decTex
    End Function

    ''' <summary>
    ''' 新規の場合、見積データを取得します(新規の場合)
    ''' </summary>
    ''' <param name="loginId">セッション．ログインID</param>
    ''' <param name="kojiNo">リクエスト．工事No.</param>
    ''' <returns>見積情報</returns>
    ''' <remarks></remarks>
    Public Function FETCH_DATA_NEW_MITUMORI(ByVal loginId As String, ByVal kojiNo As String, ByRef errInfo As PLSQLErrorInfo) As DataSet

        Dim strCmdText As String
        strCmdText = "PG_KJ0020.FETCH_DATA_NEW_MITUMORI"

        Dim parameters(5) As OracleParameter

        Dim I_VC_LOGINID As New OracleParameter("I_VC_LOGINID", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_LOGINID.Value = loginId

        Dim I_VC_KOJI_NO As New OracleParameter("I_VC_KOJI_NO", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_KOJI_NO.Value = kojiNo
        Dim O_CU_MITUMORI As New OracleParameter("O_CU_MITUMORI", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_CU_SEIKYUSAKI As New OracleParameter("O_CU_SEIKYUSAKI", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_CU_ERR As New OracleParameter("O_CU_ERR", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_STATS As New OracleParameter("O_STATS", OracleDbType.Int32, ParameterDirection.ReturnValue)

        parameters(0) = I_VC_LOGINID
        parameters(1) = I_VC_KOJI_NO
        parameters(2) = O_CU_MITUMORI
        parameters(3) = O_CU_SEIKYUSAKI
        parameters(4) = O_CU_ERR
        parameters(5) = O_STATS

        Dim ds As DataSet
        Dim tableNames(1) As String
        tableNames(0) = "MITUMORI"      '見積
        tableNames(1) = "SEIKYUSAKI"    '工事請求

        ds = OracleHelp.FillTable(OracleHelp.ConnectionStringLocalTransaction,
                                           CommandType.StoredProcedure,
                                           strCmdText,
                                           errInfo,
                                           parameters,
                                           tableNames)


        Return ds
    End Function

    ''' <summary>
    ''' 見積データ取得
    ''' </summary>
    ''' <param name="loginId">セッション．ログインID</param>
    ''' <param name="kojiNo">リクエスト．工事No.</param>
    ''' <returns>見積情報</returns>
    ''' <remarks></remarks>
    Public Function FETCH_DATA_MITUMORI(ByVal loginId As String, ByVal kojiNo As String, ByRef errInfo As PLSQLErrorInfo) As DataSet
        Dim strCmdText As String
        strCmdText = "PG_KJ0020.FETCH_DATA_MITUMORI"

        Dim parameters(8) As OracleParameter

        Dim I_VC_LOGINID As New OracleParameter("I_VC_LOGINID", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_LOGINID.Value = loginId

        Dim I_VC_KOJI_NO As New OracleParameter("I_VC_KOJI_NO", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_KOJI_NO.Value = kojiNo
        Dim O_CU_MITUMORI As New OracleParameter("O_CU_MITUMORI", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_CU_SEIKYUSAKI As New OracleParameter("O_CU_SEIKYUSAKI", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_CU_HACCHUSAKI As New OracleParameter("O_CU_HACCHUSAKI", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_CU_MITUMORI_MEISAI As New OracleParameter("O_CU_MITUMORI_MEISAI", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_CU_SEIKYU_WARIAI As New OracleParameter("O_CU_SEIKYU_WARIAI", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_CU_ERR As New OracleParameter("O_CU_ERR", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_STATS As New OracleParameter("O_STATS", OracleDbType.Int32, ParameterDirection.ReturnValue)

        parameters(0) = I_VC_LOGINID
        parameters(1) = I_VC_KOJI_NO
        parameters(2) = O_CU_MITUMORI
        parameters(3) = O_CU_SEIKYUSAKI
        parameters(4) = O_CU_HACCHUSAKI
        parameters(5) = O_CU_MITUMORI_MEISAI
        parameters(6) = O_CU_SEIKYU_WARIAI
        parameters(7) = O_CU_ERR
        parameters(8) = O_STATS

        Dim ds As DataSet
        Dim tableNames(4) As String
        tableNames(0) = "MITUMORI"          '見積
        tableNames(1) = "SEIKYUSAKI"        '工事請求
        tableNames(2) = "HACCHUSAKI"        '発注先
        tableNames(3) = "MITUMORI_MEISAI"   '見積明細
        tableNames(4) = "SEIKYU_WARIAI"     '請求割合

        ds = OracleHelp.FillTable(OracleHelp.ConnectionStringLocalTransaction,
                                           CommandType.StoredProcedure,
                                           strCmdText,
                                           errInfo,
                                           parameters,
                                           tableNames)


        Return ds
    End Function

    ''' <summary>
    ''' 見積データを保存します
    ''' </summary>
    ''' <param name="loginId">セッション．ログインID</param>
    ''' <param name="syoriKbn">処理区分（1：新規、2：修正、3：削除）</param>
    ''' <param name="dsUpd">更新用データセット</param>
    ''' <param name="strBtnKbn">ボタン区分 1:明細 2:進捗</param>
    ''' <param name="errInfo">処理結果</param>
    ''' <remarks></remarks>
    Public Sub SAVE_DATE(ByVal loginId As String, ByVal syoriKbn As String, ByVal dsUpd As DataSet, ByVal strBtnKbn As String, ByRef errInfo As PLSQLErrorInfo)
        Dim OracleCon As New OracleConnection(OracleHelp.ConnectionStringLocalTransaction)
        OracleCon.Open()
        Dim OracleTrans As OracleTransaction = OracleCon.BeginTransaction()
        Try

            If "MEISAI".Equals(strBtnKbn) And (ComConst.DBMODE.INSERT.Equals(syoriKbn) _
                                               OrElse ComConst.DBMODE.DELETE.Equals(syoriKbn)) Then
                SAVE_DATA_MITUMORI(loginId, syoriKbn, dsUpd, errInfo, OracleTrans)
            ElseIf "SINTYOKU".Equals(strBtnKbn) Then
                SAVE_DATA_MITUMORI(loginId, syoriKbn, dsUpd, errInfo, OracleTrans)
            End If

            If "MEISAI".Equals(strBtnKbn) And Not ComConst.DBMODE.DELETE.Equals(syoriKbn) Then
                SAVE_DATA_MITUMORI_MEISAI(loginId, syoriKbn, dsUpd, errInfo, OracleTrans)
            End If

            If errInfo.RETCD = ComConst.ORA_RET_OK Then
                OracleTrans.Commit()
            ElseIf errInfo.RETCD = ComConst.ORA_RET_NG Then
                OracleTrans.Rollback()
            End If

        Catch ex As Exception
            OracleTrans.Rollback()
            Throw ex
        End Try

    End Sub

    ''' <summary>
    ''' 見積データ更新
    ''' </summary>
    ''' <param name="loginId">ログインID</param>
    ''' <param name="syoriKbn">処理区分（1：新規、2：修正、3：削除）</param>
    ''' <param name="dsUpd">更新用データセット</param>
    ''' <returns>処理結果</returns>
    ''' <remarks></remarks>
    Public Function SAVE_DATA_MITUMORI(ByVal loginId As String, ByVal syoriKbn As String, ByVal dsUpd As DataSet, ByRef errInfo As PLSQLErrorInfo, ByVal OracleTrans As OracleTransaction) As DataSet
        Dim dsRet As New DataSet

        '見積ヘッダのＳＱＬ文を取得
        Dim InsertMitumoriSql As StringBuilder = INSERT_INTO_MITUMORI()
        '見積ヘッダ
        Dim dtMitumori As DataTable = dsUpd.Tables("MITUMORI")
        '見積データのパラメータをセット
        For i As Integer = 0 To dtMitumori.Rows.Count - 1
            Dim mitumoriparameters As OracleParameter() = MitumoriParametersByInsert(dtMitumori.Rows(i))
            OracleHelp.ExecuteNonQuery(OracleTrans, CommandType.Text, InsertMitumoriSql.ToString, mitumoriparameters)
        Next

        If Not ComConst.DBMODE.DELETE.Equals(syoriKbn) Then

            '請求先のＳＱＬ文を取得
            Dim InsertSeikyusaki As StringBuilder = INSERT_INTO_SEIKYUSAKI()
            '請求先
            Dim dtSeikyusaki As DataTable = dsUpd.Tables("SEIKYUSAKI")
            '請求先のパラメータをセット
            For i As Integer = 0 To dtSeikyusaki.Rows.Count - 1
                Dim seikyusakiparameters As OracleParameter() = SeikyusakiParameterByInsert(dtSeikyusaki.Rows(i))
                OracleHelp.ExecuteNonQuery(OracleTrans, CommandType.Text, InsertSeikyusaki.ToString, seikyusakiparameters)
            Next

            '発注先のＳＱＬ文を取得
            Dim InsertHacchusaki As StringBuilder = INSERT_INTO_HACCHUSAKI()
            '発注先
            Dim dtHacchusaki As DataTable = dsUpd.Tables("HACCHUSAKI")
            '発注のパラメータをセット
            For i As Integer = 0 To dtHacchusaki.Rows.Count - 1
                Dim hacchusakiparameters As OracleParameter() = HacchusakiParameterByInsert(dtHacchusaki.Rows(i))
                OracleHelp.ExecuteNonQuery(OracleTrans, CommandType.Text, InsertHacchusaki.ToString, hacchusakiparameters)
            Next
        End If

        Dim strCmdText As String
        strCmdText = "PG_KJ0020.SAVE_DATA_MITUMORI"

        Dim parameters(3) As OracleParameter

        Dim I_VC_LOGINID As New OracleParameter("I_VC_LOGINID", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_LOGINID.Value = loginId

        Dim I_VC_SHORI_KB As New OracleParameter("I_VC_SHORI_KB", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_SHORI_KB.Value = syoriKbn
        Dim O_CU_ERR As New OracleParameter("O_CU_ERR", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_STATS As New OracleParameter("O_STATS", OracleDbType.Decimal, ParameterDirection.ReturnValue)

        parameters(0) = I_VC_LOGINID
        parameters(1) = I_VC_SHORI_KB
        parameters(2) = O_CU_ERR
        parameters(3) = O_STATS

        OracleHelp.ExecuteNonQuery(OracleTrans,
                                           CommandType.StoredProcedure,
                                           strCmdText,
                                           errInfo,
                                           parameters)

        Return dsRet
    End Function

    ''' <summary>
    ''' 見積明細データ更新
    ''' </summary>
    ''' <param name="loginId">ログインID</param>
    ''' <param name="syoriKbn">処理区分（1：新規、2：修正、3：削除）</param>
    ''' <param name="dsUpd">更新用データセット</param>
    ''' <returns>処理結果</returns>
    ''' <remarks></remarks>
    Public Function SAVE_DATA_MITUMORI_MEISAI(ByVal loginId As String, ByVal syoriKbn As String, ByVal dsUpd As DataSet, ByRef errInfo As PLSQLErrorInfo, ByVal OracleTrans As OracleTransaction) As DataSet
        Dim dsRet As New DataSet

        '見積明細
        Dim dtMitumoriMeisai As DataTable = dsUpd.Tables("MITUMORI_MEISAI")
        '見積明細のSQL文を取得
        Dim InsertMitumori_MeisaiSql As StringBuilder = INSERT_INTO_MITUMORI_MEISAI()
        '見積明細のパラメータをセット
        For i As Integer = 0 To dtMitumoriMeisai.Rows.Count - 1
            Dim mitumoriparameters As OracleParameter() = MitumoriMeisaiParameterByInsert(dtMitumoriMeisai.Rows(i))
            OracleHelp.ExecuteNonQuery(OracleTrans, CommandType.Text, InsertMitumori_MeisaiSql.ToString, mitumoriparameters)
        Next

        '請求割合
        Dim dtSeikyuWariai As DataTable = dsUpd.Tables("SEIKYU_WARIAI")
        '請求割合のSQL文を取得
        Dim InsertSeikyuWaraaiSql As StringBuilder = INSERT_INTO_SEIKYU_WARIAI()
        '請求割合のパラメータをセット
        For i As Integer = 0 To dtSeikyuWariai.Rows.Count - 1
            Dim seikyuparameters As OracleParameter() = SeikyuwariaiParametersByInsert(dtSeikyuWariai.Rows(i))
            OracleHelp.ExecuteNonQuery(OracleTrans, CommandType.Text, InsertSeikyuWaraaiSql.ToString, seikyuparameters)
        Next

        Dim strCmdText As String
        strCmdText = "PG_KJ0020.SAVE_DATA_MITUMORI_MEISAI"

        Dim parameters(3) As OracleParameter

        Dim I_VC_LOGINID As New OracleParameter("I_VC_LOGINID", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_LOGINID.Value = loginId

        Dim I_VC_SHORI_KB As New OracleParameter("I_VC_SHORI_KB", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_SHORI_KB.Value = syoriKbn
        Dim O_CU_ERR As New OracleParameter("O_CU_ERR", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_STATS As New OracleParameter("O_STATS", OracleDbType.Decimal, ParameterDirection.ReturnValue)

        parameters(0) = I_VC_LOGINID
        parameters(1) = I_VC_SHORI_KB
        parameters(2) = O_CU_ERR
        parameters(3) = O_STATS

        OracleHelp.ExecuteNonQuery(OracleTrans,
                                           CommandType.StoredProcedure,
                                           strCmdText,
                                           errInfo,
                                           parameters)

        Return dsRet
    End Function

    ''' <summary>
    ''' 見積ヘッダについてのSQL文
    ''' </summary>
    ''' <remarks></remarks>
    Private Function INSERT_INTO_MITUMORI()
        Dim insertSql As StringBuilder = New StringBuilder

        insertSql.AppendLine("INSERT INTO ")
        insertSql.AppendLine("T_KJ0020T3(")
        insertSql.AppendLine("          ROWID_ANKEN,")          '工事案件データROWID
        insertSql.AppendLine("          ROWID_MITUMORI,")       '見積データROWID		
        insertSql.AppendLine("          LAST_EMP_NM,")          '最終更新担当者
        insertSql.AppendLine("          LAST_TMS,")             '最終更新日
        insertSql.AppendLine("          KOJI_NO,")              '工事No.
        insertSql.AppendLine("          MITUMORI_NO,")          '見積NO.
        insertSql.AppendLine("          MITUMORI_NM,")          '見積名
        insertSql.AppendLine("          MITUMORI_ST,")          '見積状態
        insertSql.AppendLine("          MITUMORI_ST_NM,")       '見積状態名称
        insertSql.AppendLine("          TUIKA_KOJI_FG,")        '追加工事フラグ
        insertSql.AppendLine("          TUIKA_KOJI_JIYU,")      '追加工事事由
        insertSql.AppendLine("          KOJI_CHUSI_FG,")        '工事中止フラグ
        insertSql.AppendLine("          KOJI_CHUSI_JIYU,")      '工事中止事由
        insertSql.AppendLine("          MITUMORI_DT,")          '見積日
        insertSql.AppendLine("          MITUMORI_EMP_CD,")      '見積担当者CD
        insertSql.AppendLine("          MITUMORI_EMP_NM,")      '見積担当者名
        insertSql.AppendLine("          HOKOKU_DT,")            '報告日
        insertSql.AppendLine("          SINSEI_DT,")            '承認申請日
        insertSql.AppendLine("          SINSEI_EMP_CD,")        '承認申請担当者CD
        insertSql.AppendLine("          SINSEI_EMP_NM,")        '承認申請担当者名
        insertSql.AppendLine("          SHONIN_DT,")            '発注承認日
        insertSql.AppendLine("          SHONIN_EMP_CD,")        '発注承認担当者CD
        insertSql.AppendLine("          SHONIN_EMP_NM,")        '発注承認担当者名
        insertSql.AppendLine("          DAIITI_FG)")            '第一見積フラグ
        insertSql.AppendLine("VALUES(")
        insertSql.AppendLine("          :ROWID_ANKEN,")
        insertSql.AppendLine("          :ROWID_MITUMORI,")
        insertSql.AppendLine("          :LAST_EMP_NM,")
        insertSql.AppendLine("          :LAST_TMS,")
        insertSql.AppendLine("          :KOJI_NO,")
        insertSql.AppendLine("          :MITUMORI_NO,")
        insertSql.AppendLine("          :MITUMORI_NM,")
        insertSql.AppendLine("          :MITUMORI_ST,")
        insertSql.AppendLine("          :MITUMORI_ST_NM,")
        insertSql.AppendLine("          :TUIKA_KOJI_FG,")
        insertSql.AppendLine("          :TUIKA_KOJI_JIYU,")
        insertSql.AppendLine("          :KOJI_CHUSI_FG,")
        insertSql.AppendLine("          :KOJI_CHUSI_JIYU,")
        insertSql.AppendLine("          :MITUMORI_DT,")
        insertSql.AppendLine("          :MITUMORI_EMP_CD,")
        insertSql.AppendLine("          :MITUMORI_EMP_NM,")
        insertSql.AppendLine("          :HOKOKU_DT,")
        insertSql.AppendLine("          :SINSEI_DT,")
        insertSql.AppendLine("          :SINSEI_EMP_CD,")
        insertSql.AppendLine("          :SINSEI_EMP_NM,")
        insertSql.AppendLine("          :SHONIN_DT,")
        insertSql.AppendLine("          :SHONIN_EMP_CD,")
        insertSql.AppendLine("          :SHONIN_EMP_NM,")
        insertSql.AppendLine("          :DAIITI_FG)")

        Return insertSql
    End Function

    ''' <summary>
    ''' 見積明細についてのSQL文
    ''' </summary>
    ''' <remarks></remarks>
    Private Function INSERT_INTO_MITUMORI_MEISAI()
        Dim insertSql As StringBuilder = New StringBuilder

        insertSql.AppendLine("INSERT INTO ")
        insertSql.AppendLine("T_KJ0020T6(")
        insertSql.AppendLine("                ENT_EMP_CD,")                 '見積明細．登録社員CD（非表示列）
        insertSql.AppendLine("                ENT_TMS,")                    '見積明細．登録日時（非表示列）
        insertSql.AppendLine("                ENT_PGID,")                   '見積明細．登録プログラムID（非表示列）
        insertSql.AppendLine("                KOJI_NO,")                    '工事No.
        insertSql.AppendLine("                MITUMORI_NO,")                '見積番号
        insertSql.AppendLine("                HACCHU_GYOSHA_CD,")           '発注業者CD
        insertSql.AppendLine("                HACCHU_GYOSHA_NM,")           '発注業者名
        insertSql.AppendLine("                ROW_NO,")                     '行No.
        insertSql.AppendLine("                KOJI_KOMOKU_CD,")             '見積明細．項目（CD）
        insertSql.AppendLine("                KOJI_KOMOKU_NM,")             '見積明細．項目（名称）
        insertSql.AppendLine("                TEIAN_FG,")                   '見積明細．提案   
        insertSql.AppendLine("                HOSHU_KASHO,")                '見積明細．補修個所
        insertSql.AppendLine("                SHAGAI_TEKIYO,")              '見積明細．社内摘要
        insertSql.AppendLine("                SHANAI_TEKIYO,")              '見積明細．社外摘要
        insertSql.AppendLine("                TANI,")                       '見積明細．単位
        insertSql.AppendLine("                SURYO,")                      '見積明細．数量
        insertSql.AppendLine("                HACCHU_TANKA,")               '見積明細．発注・単価
        insertSql.AppendLine("                HACCHU_KINGAKU,")             '見積明細．発注・税抜
        insertSql.AppendLine("                SEISAN_TANKA,")               '見積明細．精算・単価
        insertSql.AppendLine("                SEISAN_KINGAKU,")             '見積明細．精算・税抜
        insertSql.AppendLine("                ARARIEKI,")                   '見積明細．粗利・益
        insertSql.AppendLine("                ARARI_RITU,")                 '見積明細．粗利・率
        insertSql.AppendLine("                SORT_NO)")                    'ソート
        insertSql.AppendLine("VALUES(")
        insertSql.AppendLine("                :ENT_EMP_CD,")                '見積明細．登録社員CD（非表示列）
        insertSql.AppendLine("                :ENT_TMS,")                   '見積明細．登録日時（非表示列）
        insertSql.AppendLine("                :ENT_PGID,")                  '見積明細．登録プログラムID（非表示列）
        insertSql.AppendLine("                :KOJI_NO,")                   '工事No.
        insertSql.AppendLine("                :MITUMORI_NO,")               '見積番号
        insertSql.AppendLine("                :HACCHU_GYOSHA_CD,")          '発注業者CD
        insertSql.AppendLine("                :HACCHU_GYOSHA_NM,")          '発注業者名
        insertSql.AppendLine("                :ROW_NO,")                    '行No.
        insertSql.AppendLine("                :KOJI_KOMOKU_CD,")            '見積明細．項目（CD）
        insertSql.AppendLine("                :KOJI_KOMOKU_NM,")            '見積明細．項目（名称）
        insertSql.AppendLine("                :TEIAN_FG,")                  '見積明細．提案   
        insertSql.AppendLine("                :HOSHU_KASHO,")               '見積明細．補修個所
        insertSql.AppendLine("                :SHANAI_TEKIYO,")             '見積明細．社内摘要
        insertSql.AppendLine("                :SHAGAI_TEKIYO,")             '見積明細．社外摘要
        insertSql.AppendLine("                :TANI,")                      '見積明細．単位
        insertSql.AppendLine("                :SURYO,")                     '見積明細．数量
        insertSql.AppendLine("                :HACCHU_TANKA,")              '見積明細．発注・単価
        insertSql.AppendLine("                :HACCHU_KINGAKU,")            '見積明細．発注・税抜
        insertSql.AppendLine("                :SEISAN_TANKA,")              '見積明細．精算・単価
        insertSql.AppendLine("                :SEISAN_KINGAKU,")            '見積明細．精算・税抜
        insertSql.AppendLine("                :ARARIEKI,")                  '見積明細．粗利・益
        insertSql.AppendLine("                :ARARI_RITU,")                '見積明細．粗利・率
        insertSql.AppendLine("                :SORT_NO)")                   'ソート

        Return insertSql
    End Function

    ''' <summary>
    ''' 請求先についてのSQL文
    ''' </summary>
    ''' <remarks></remarks>
    Private Function INSERT_INTO_SEIKYUSAKI()
        Dim insertSql As StringBuilder = New StringBuilder

        insertSql.AppendLine("INSERT INTO ")
        insertSql.AppendLine("T_KJ0020T4(")
        insertSql.AppendLine("           ENT_EMP_CD,")                  '登録担当者CD
        insertSql.AppendLine("           ENT_TMS,")                     '登録日時
        insertSql.AppendLine("           ENT_PGID,")                    '登録プログラムID
        insertSql.AppendLine("           KOJI_NO,")                     '工事No.
        insertSql.AppendLine("           MITUMORI_NO,")                 '見積NO.
        insertSql.AppendLine("           SEIKYUSAKI_SHUBETU,")          '請求先種別
        insertSql.AppendLine("           SEIKYUSAKI_SHUBETU_NM,")       '請求先種別名称
        insertSql.AppendLine("           CUSTOMER_CD,")                 '顧客CD
        insertSql.AppendLine("           CUSTOMER_NM,")                 '顧客名
        insertSql.AppendLine("           SEISAN_KINGAKU,")              '請求額(税抜)
        insertSql.AppendLine("           SEISAN_ZEIGAKU,")              '請求額(税)
        insertSql.AppendLine("           SEISAN_ZEIKOMI,")              '請求額(税込)
        insertSql.AppendLine("           HACCHU_KINGAKU,")              '発注額(税抜)
        insertSql.AppendLine("           HACCHU_ZEIGAKU,")              '発注額(税)
        insertSql.AppendLine("           HACCHU_ZEIKOMI,")              '発注額(税込)
        insertSql.AppendLine("           TEISHUTU_DT,")                 '見積提出日
        insertSql.AppendLine("           TEISHUTU_EMP_CD,")             '見積提出担当者CD
        insertSql.AppendLine("           TEISHUTU_EMP_NM,")             '見積提出担当者名
        insertSql.AppendLine("           SHODAKU_DT,")                  '見積承諾日
        insertSql.AppendLine("           SHODAKU_EMP_CD,")              '見積承諾担当者CD
        insertSql.AppendLine("           SHODAKU_EMP_NM,")              '見積承諾担当者名
        insertSql.AppendLine("           SEIKYU_DT,")                   '請求日
        insertSql.AppendLine("           SEIKYU_EMP_CD,")               '請求担当者CD
        insertSql.AppendLine("           SEIKYU_EMP_NM,")               '請求担当者名
        insertSql.AppendLine("           KAISHU_NO,")                   '回収No.
        insertSql.AppendLine("           KAISHU_KAISU,")                '回収回数
        insertSql.AppendLine("           KAISHU_EMP_CD,")               '回収担当者CD
        insertSql.AppendLine("           KAISHU_EMP_NM,")               '回収担当者名
        insertSql.AppendLine("           SHONIN_EMP_CD,")               '回収承認担当者CD
        insertSql.AppendLine("           SHONIN_EMP_NM,")               '回収承認担当者名
        insertSql.AppendLine("           MITUMORI_BIKO,")               '見積書備考
        insertSql.AppendLine("           SIWAKE_DT,")                   '仕訳日
        insertSql.AppendLine("           DENPYO_NO)")                   '伝票No.
        insertSql.AppendLine("VALUES(                 ")
        insertSql.AppendLine("           :ENT_EMP_CD,")
        insertSql.AppendLine("           :ENT_TMS,")
        insertSql.AppendLine("           :ENT_PGID,")
        insertSql.AppendLine("           :KOJI_NO,")
        insertSql.AppendLine("           :MITUMORI_NO,")
        insertSql.AppendLine("           :SEIKYUSAKI_SHUBETU,")
        insertSql.AppendLine("           :SEIKYUSAKI_SHUBETU_NM,")
        insertSql.AppendLine("           :CUSTOMER_CD,")
        insertSql.AppendLine("           :CUSTOMER_NM,")
        insertSql.AppendLine("           :SEISAN_KINGAKU,")
        insertSql.AppendLine("           :SEISAN_ZEIGAKU,")
        insertSql.AppendLine("           :SEISAN_ZEIKOMI,")
        insertSql.AppendLine("           :HACCHU_KINGAKU,")
        insertSql.AppendLine("           :HACCHU_ZEIGAKU,")
        insertSql.AppendLine("           :HACCHU_ZEIKOMI,")
        insertSql.AppendLine("           :TEISHUTU_DT,")
        insertSql.AppendLine("           :TEISHUTU_EMP_CD,")
        insertSql.AppendLine("           :TEISHUTU_EMP_NM,")
        insertSql.AppendLine("           :SHODAKU_DT,")
        insertSql.AppendLine("           :SHODAKU_EMP_CD,")
        insertSql.AppendLine("           :SHODAKU_EMP_NM,")
        insertSql.AppendLine("           :SEIKYU_DT,")
        insertSql.AppendLine("           :SEIKYU_EMP_CD,")
        insertSql.AppendLine("           :SEIKYU_EMP_NM,")
        insertSql.AppendLine("           :KAISHU_NO,")
        insertSql.AppendLine("           :KAISHU_KAISU,")
        insertSql.AppendLine("           :KAISHU_EMP_CD,")
        insertSql.AppendLine("           :KAISHU_EMP_NM,")
        insertSql.AppendLine("           :SHONIN_EMP_CD,")
        insertSql.AppendLine("           :SHONIN_EMP_NM,")
        insertSql.AppendLine("           :MITUMORI_BIKO,")
        insertSql.AppendLine("           :SIWAKE_DT,")
        insertSql.AppendLine("           :DENPYO_NO)")

        Return insertSql
    End Function

    ''' <summary>
    ''' 発注先についてのSQL文
    ''' </summary>
    ''' <remarks></remarks>
    Private Function INSERT_INTO_HACCHUSAKI()
        Dim insertSql As StringBuilder = New StringBuilder

        insertSql.AppendLine("INSERT INTO ")
        insertSql.AppendLine("T_KJ0020T5(")
        insertSql.AppendLine("           ENT_EMP_CD,")              '発注先進捗．登録社員CD（非表示列）
        insertSql.AppendLine("           ENT_TMS,")                 '発注先進捗．登録日時（非表示列
        insertSql.AppendLine("           ENT_PGID,")                '発注先進捗．登録プログラムID（非表示列）
        insertSql.AppendLine("           KOJI_NO,")                 '工事NO. 
        insertSql.AppendLine("           MITUMORI_NO,")             '見積番号
        insertSql.AppendLine("           HACCHU_GYOSHA_CD,")        '発注業者CD
        insertSql.AppendLine("           HACCHU_GYOSHA_NM,")        '発注業者名
        insertSql.AppendLine("           HACCHU_KINGAKU,")          '発注額(税抜)
        insertSql.AppendLine("           HACCHU_ZEIGAKU,")          '発注額(税)
        insertSql.AppendLine("           HACCHU_ZEIKOMI,")          '発注額(税込)
        insertSql.AppendLine("           HACCHU_DT,")               '発注先進捗．発注日
        insertSql.AppendLine("           HACCHU_EMP_CD,")           '発注担当者CD
        insertSql.AppendLine("           HACCHU_EMP_NM,")           '発注担当者名
        insertSql.AppendLine("           KANRYO_YT_DT,")            '発注先進捗．完了予定日
        insertSql.AppendLine("           KANRYO_YT_EMP_CD,")        '完了予定担当者CD
        insertSql.AppendLine("           KANRYO_YT_EMP_NM,")        '完了予定担当者名
        insertSql.AppendLine("           KANRYO_DT,")               '発注先進捗．工事完了日
        insertSql.AppendLine("           KANRYO_EMP_CD,")           '完了担当者CD
        insertSql.AppendLine("           KANRYO_EMP_NM,")           '完了担当者名
        insertSql.AppendLine("           SIHARAI_YT_DT,")           '発注先進捗．支払予定日
        insertSql.AppendLine("           SIHARAI_YT_EMP_CD,")       '支払予定担当者CD
        insertSql.AppendLine("           SIHARAI_YT_EMP_NM,")       '支払予定担当者名
        insertSql.AppendLine("           SIHARAI_DT,")              '発注先進捗．支払日
        insertSql.AppendLine("           SIHARAI_EMP_CD,")          '支払担当者CD
        insertSql.AppendLine("           SIHARAI_EMP_NM,")          '支払担当者名
        insertSql.AppendLine("           HACCHU_BIKO,")             '発注書備考
        insertSql.AppendLine("           HACCHU_PRINT_FG,")         '発注書印刷フラグ（非表示）
        insertSql.AppendLine("           SIHARAI_FB_NO,")           '業者支払FBNo.（非表示）
        insertSql.AppendLine("           SIWAKE_DT,")               '仕訳日
        insertSql.AppendLine("           DENPYO_NO)")               '伝票No.
        insertSql.AppendLine("VALUES(")
        insertSql.AppendLine("           :ENT_EMP_CD,")              '発注先進捗．登録社員CD（非表示列）
        insertSql.AppendLine("           :ENT_TMS,")                 '発注先進捗．登録日時（非表示列
        insertSql.AppendLine("           :ENT_PGID,")                '発注先進捗．登録プログラムID（非表示列）
        insertSql.AppendLine("           :KOJI_NO,")                 '工事NO. 
        insertSql.AppendLine("           :MITUMORI_NO,")             '見積番号
        insertSql.AppendLine("           :HACCHU_GYOSHA_CD,")        '発注業者CD
        insertSql.AppendLine("           :HACCHU_GYOSHA_NM,")        '発注業者名
        insertSql.AppendLine("           :HACCHU_KINGAKU,")          '発注額(税抜)
        insertSql.AppendLine("           :HACCHU_ZEIGAKU,")          '発注額(税)
        insertSql.AppendLine("           :HACCHU_ZEIKOMI,")          '発注額(税込)
        insertSql.AppendLine("           :HACCHU_DT,")               '発注先進捗．発注日
        insertSql.AppendLine("           :HACCHU_EMP_CD,")           '発注担当者CD
        insertSql.AppendLine("           :HACCHU_EMP_NM,")           '発注担当者名
        insertSql.AppendLine("           :KANRYO_YT_DT,")            '発注先進捗．完了予定日
        insertSql.AppendLine("           :KANRYO_YT_EMP_CD,")        '完了予定担当者CD
        insertSql.AppendLine("           :KANRYO_YT_EMP_NM,")        '完了予定担当者名
        insertSql.AppendLine("           :KANRYO_DT,")               '発注先進捗．工事完了日
        insertSql.AppendLine("           :KANRYO_EMP_CD,")           '完了担当者CD
        insertSql.AppendLine("           :KANRYO_EMP_NM,")           '完了担当者名
        insertSql.AppendLine("           :SIHARAI_YT_DT,")           '発注先進捗．支払予定日
        insertSql.AppendLine("           :SIHARAI_YT_EMP_CD,")       '支払予定担当者CD
        insertSql.AppendLine("           :SIHARAI_YT_EMP_NM,")       '支払予定担当者名
        insertSql.AppendLine("           :SIHARAI_DT,")              '発注先進捗．支払日
        insertSql.AppendLine("           :SIHARAI_EMP_CD,")          '支払担当者CD
        insertSql.AppendLine("           :SIHARAI_EMP_NM,")          '支払担当者名
        insertSql.AppendLine("           :HACCHU_BIKO,")             '発注書備考
        insertSql.AppendLine("           :HACCHU_PRINT_FG,")         '発注書印刷フラグ（非表示）
        insertSql.AppendLine("           :SIHARAI_FB_NO,")           '業者支払FBNo.（非表示）
        insertSql.AppendLine("           :SIWAKE_DT,")               '仕訳日
        insertSql.AppendLine("           :DENPYO_NO)")               '伝票No.

        Return insertSql
    End Function


    ''' <summary>
    ''' 見積明細のパラメータをセット
    ''' </summary>
    ''' <remarks></remarks>
    Private Function MitumoriMeisaiParameterByInsert(ByVal drMitumori_Meisai As DataRow) As OracleParameter()
        Dim parameters(22) As OracleParameter

        Dim ENT_EMP_CD As New OracleParameter("ENT_EMP_CD", OracleDbType.Varchar2, 10)              '見積明細．登録社員CD（非表示列）
        Dim ENT_TMS As New OracleParameter("ENT_TMS", OracleDbType.Varchar2, 17)                    '見積明細．登録日時（非表示列）
        Dim ENT_PGID As New OracleParameter("ENT_PGID", OracleDbType.Varchar2, 6)                   '見積明細．登録プログラムID（非表示列）
        Dim KOJI_NO As New OracleParameter("KOJI_NO", OracleDbType.Varchar2, 10)                    '工事No.
        Dim MITUMORI_NO As New OracleParameter("MITUMORI_NO", OracleDbType.Int16, 3)                '見積番号
        Dim HACCHU_GYOSHA_CD As New OracleParameter("HACCHU_GYOSHA_CD", OracleDbType.Varchar2, 10)  '発注業者CD
        Dim HACCHU_GYOSHA_NM As New OracleParameter("HACCHU_GYOSHA_NM", OracleDbType.Varchar2, 50)  '発注業者名
        Dim ROW_NO As New OracleParameter("ROW_NO", OracleDbType.Int16, 3)                          '行No.
        Dim KOJI_KOMOKU_CD As New OracleParameter("KOJI_KOMOKU_CD", OracleDbType.Varchar2, 10)      '見積明細．項目（CD）
        Dim KOJI_KOMOKU_NM As New OracleParameter("KOJI_KOMOKU_NM", OracleDbType.Varchar2, 100)     '見積明細．項目（名称）
        Dim TEIAN_FG As New OracleParameter("TEIAN_FG", OracleDbType.Int16, 1)                      '見積明細．提案   
        Dim HOSHU_KASHO As New OracleParameter("HOSHU_KASHO", OracleDbType.Varchar2, 100)           '見積明細．補修個所
        Dim SHANAI_TEKIYO As New OracleParameter("SHANAI_TEKIYO", OracleDbType.Varchar2, 100)       '見積明細．社内摘要
        Dim SHAGAI_TEKIYO As New OracleParameter("SHAGAI_TEKIYO", OracleDbType.Varchar2, 100)       '見積明細．社外摘要
        Dim TANI As New OracleParameter("TANI", OracleDbType.Varchar2, 4)                           '見積明細．単位
        Dim SURYO As New OracleParameter("SURYO", OracleDbType.Decimal)                             '見積明細．数量
        Dim HACCHU_TANKA As New OracleParameter("HACCHU_TANKA", OracleDbType.Decimal)               '見積明細．発注・単価
        Dim HACCHU_KINGAKU As New OracleParameter("HACCHU_KINGAKU", OracleDbType.Decimal)           '見積明細．発注・税抜
        Dim SEISAN_TANKA As New OracleParameter("SEISAN_TANKA", OracleDbType.Decimal)               '見積明細．精算・単価
        Dim SEISAN_KINGAKU As New OracleParameter("SEISAN_KINGAKU", OracleDbType.Decimal)           '見積明細．精算・税抜
        Dim ARARIEKI As New OracleParameter("ARARIEKI", OracleDbType.Decimal)                       '見積明細．粗利・益
        Dim ARARI_RITU As New OracleParameter("ARARI_RITU", OracleDbType.Decimal)                   '見積明細．粗利・率
        Dim SORT_NO As New OracleParameter("SORT_NO", OracleDbType.Int16, 3)                        'ソート

        With drMitumori_Meisai
            ENT_EMP_CD.Value = .Item("ENT_EMP_CD")
            ENT_TMS.Value = .Item("ENT_TMS")
            ENT_PGID.Value = .Item("ENT_PGID")
            KOJI_NO.Value = .Item("KOJI_NO")
            MITUMORI_NO.Value = .Item("MITUMORI_NO")
            HACCHU_GYOSHA_CD.Value = .Item("HACCHU_GYOSHA_CD")
            HACCHU_GYOSHA_NM.Value = .Item("HACCHU_GYOSHA_NM")
            ROW_NO.Value = .Item("ROW_NO")
            KOJI_KOMOKU_CD.Value = .Item("KOJI_KOMOKU_CD")
            KOJI_KOMOKU_NM.Value = .Item("KOJI_KOMOKU_NM")
            TEIAN_FG.Value = .Item("TEIAN_FG")
            HOSHU_KASHO.Value = .Item("HOSHU_KASHO")
            SHANAI_TEKIYO.Value = .Item("SHANAI_TEKIYO")
            SHAGAI_TEKIYO.Value = .Item("SHAGAI_TEKIYO")
            TANI.Value = .Item("TANI")
            SURYO.Value = .Item("SURYO")
            HACCHU_TANKA.Value = .Item("HACCHU_TANKA")
            HACCHU_KINGAKU.Value = .Item("HACCHU_KINGAKU")
            SEISAN_TANKA.Value = .Item("SEISAN_TANKA")
            SEISAN_KINGAKU.Value = .Item("SEISAN_KINGAKU")
            ARARIEKI.Value = .Item("ARARIEKI")
            ARARI_RITU.Value = .Item("ARARI_RITU")
            SORT_NO.Value = .Item("SORT_NO")
        End With

        parameters(0) = ENT_EMP_CD          '見積明細．登録社員CD（非表示列）
        parameters(1) = ENT_TMS             '見積明細．登録日時（非表示列）
        parameters(2) = ENT_PGID            '見積明細．登録プログラムID（非表示列）
        parameters(3) = KOJI_NO             '工事No.
        parameters(4) = MITUMORI_NO         '見積番号
        parameters(5) = HACCHU_GYOSHA_CD    '発注業者CD
        parameters(6) = HACCHU_GYOSHA_NM    '発注業者名
        parameters(7) = ROW_NO              '行No.
        parameters(8) = KOJI_KOMOKU_CD      '見積明細．項目（CD）
        parameters(9) = KOJI_KOMOKU_NM      '見積明細．項目（名称）
        parameters(10) = TEIAN_FG           '見積明細．提案   
        parameters(11) = HOSHU_KASHO        '見積明細．補修個所
        parameters(12) = SHANAI_TEKIYO      '見積明細．社内摘要
        parameters(13) = SHAGAI_TEKIYO      '見積明細．社外摘要
        parameters(14) = TANI               '見積明細．単位
        parameters(15) = SURYO              '見積明細．数量
        parameters(16) = HACCHU_TANKA       '見積明細．発注・単価
        parameters(17) = HACCHU_KINGAKU     '見積明細．発注・税抜
        parameters(18) = SEISAN_TANKA       '見積明細．精算・単価
        parameters(19) = SEISAN_KINGAKU     '見積明細．精算・税抜
        parameters(20) = ARARIEKI           '見積明細．粗利・益
        parameters(21) = ARARI_RITU         '見積明細．粗利・率
        parameters(22) = SORT_NO            'ソート

        Return parameters
    End Function

    ''' <summary>
    ''' 工事請求データのパラメータをセット
    ''' </summary>
    ''' <remarks></remarks>
    Private Function SeikyusakiParameterByInsert(ByVal drSeikyusaki As DataRow) As OracleParameter()
        Dim parameters(32) As OracleParameter

        Dim ENT_EMP_CD As New OracleParameter("ENT_EMP_CD", OracleDbType.Varchar2, 10)                          '登録担当者CD
        Dim ENT_TMS As New OracleParameter("ENT_TMS", OracleDbType.Varchar2, 17)                                '登録日時
        Dim ENT_PGID As New OracleParameter("ENT_PGID", OracleDbType.Varchar2, 6)                               '登録プログラムID
        Dim KOJI_NO As New OracleParameter("KOJI_NO", OracleDbType.Varchar2, 10)                                '工事No.
        Dim MITUMORI_NO As New OracleParameter("MITUMORI_NO", OracleDbType.Int16, 3)                            '見積NO.
        Dim SEIKYUSAKI_SHUBETU As New OracleParameter("SEIKYUSAKI_SHUBETU", OracleDbType.Varchar2, 2)           '請求先種別
        Dim SEIKYUSAKI_SHUBETU_NM As New OracleParameter("SEIKYUSAKI_SHUBETU_NM", OracleDbType.Varchar2, 40)    '請求先種別名称
        Dim CUSTOMER_CD As New OracleParameter("CUSTOMER_CD", OracleDbType.Varchar2, 10)                        '顧客CD
        Dim CUSTOMER_NM As New OracleParameter("CUSTOMER_NM", OracleDbType.Varchar2, 140)                       '顧客名
        Dim SEISAN_KINGAKU As New OracleParameter("SEISAN_KINGAKU", OracleDbType.Decimal)                       '請求額(税抜)
        Dim SEISAN_ZEIGAKU As New OracleParameter("SEISAN_ZEIGAKU", OracleDbType.Decimal)                       '請求額(税)
        Dim SEISAN_ZEIKOMI As New OracleParameter("SEISAN_ZEIKOMI", OracleDbType.Decimal)                       '請求額(税込)
        Dim HACCHU_KINGAKU As New OracleParameter("HACCHU_KINGAKU", OracleDbType.Decimal)                       '発注額(税抜)
        Dim HACCHU_ZEIGAKU As New OracleParameter("HACCHU_ZEIGAKU", OracleDbType.Decimal)                       '発注額(税)
        Dim HACCHU_ZEIKOMI As New OracleParameter("HACCHU_ZEIKOMI", OracleDbType.Decimal)                       '発注額(税込)
        Dim TEISHUTU_DT As New OracleParameter("TEISHUTU_DT", OracleDbType.Date)                                '見積提出日
        Dim TEISHUTU_EMP_CD As New OracleParameter("TEISHUTU_EMP_CD", OracleDbType.Varchar2, 10)                '見積提出担当者CD
        Dim TEISHUTU_EMP_NM As New OracleParameter("TEISHUTU_EMP_NM", OracleDbType.Varchar2, 50)                '見積提出担当者名
        Dim SHODAKU_DT As New OracleParameter("SHODAKU_DT", OracleDbType.Date)                                  '見積承諾日
        Dim SHODAKU_EMP_CD As New OracleParameter("SHODAKU_EMP_CD", OracleDbType.Varchar2, 10)                  '見積承諾担当者CD
        Dim SHODAKU_EMP_NM As New OracleParameter("SHODAKU_EMP_NM", OracleDbType.Varchar2, 50)                  '見積承諾担当者名
        Dim SEIKYU_DT As New OracleParameter("SEIKYU_DT", OracleDbType.Date)                                    '請求日
        Dim SEIKYU_EMP_CD As New OracleParameter("SEIKYU_EMP_CD", OracleDbType.Varchar2, 10)                    '請求担当者CD
        Dim SEIKYU_EMP_NM As New OracleParameter("SEIKYU_EMP_NM", OracleDbType.Varchar2, 50)                    '請求担当者名
        Dim KAISHU_NO As New OracleParameter("KAISHU_NO", OracleDbType.Varchar2, 10)                            '回収No.
        Dim KAISHU_KAISU As New OracleParameter("KAISHU_KAISU", OracleDbType.Int16, 2)                          '回収回数
        Dim KAISHU_EMP_CD As New OracleParameter("KAISHU_EMP_CD", OracleDbType.Varchar2, 10)                    '回収担当者CD
        Dim KAISHU_EMP_NM As New OracleParameter("KAISHU_EMP_NM", OracleDbType.Varchar2, 50)                    '回収担当者名
        Dim SHONIN_EMP_CD As New OracleParameter("SHONIN_EMP_CD", OracleDbType.Varchar2, 10)                    '回収承認担当者CD
        Dim SHONIN_EMP_NM As New OracleParameter("SHONIN_EMP_NM", OracleDbType.Varchar2, 50)                    '回収承認担当者名
        Dim MITUMORI_BIKO As New OracleParameter("MITUMORI_BIKO", OracleDbType.Varchar2, 600)                   '見積書備考
        Dim SIWAKE_DT As New OracleParameter("SIWAKE_DT", OracleDbType.Date)                                    '仕訳日
        Dim DENPYO_NO As New OracleParameter("DENPYO_NO", OracleDbType.Varchar2, 10)                            '伝票No.



        With drSeikyusaki
            ENT_EMP_CD.Value = .Item("ENT_EMP_CD")
            ENT_TMS.Value = .Item("ENT_TMS")
            ENT_PGID.Value = .Item("ENT_PGID")
            KOJI_NO.Value = .Item("KOJI_NO")
            MITUMORI_NO.Value = .Item("MITUMORI_NO")
            SEIKYUSAKI_SHUBETU.Value = .Item("SEIKYUSAKI_SHUBETU")
            SEIKYUSAKI_SHUBETU_NM.Value = .Item("SEIKYUSAKI_SHUBETU_NM")
            CUSTOMER_CD.Value = .Item("CUSTOMER_CD")
            CUSTOMER_NM.Value = .Item("CUSTOMER_NM")
            SEISAN_KINGAKU.Value = .Item("SEISAN_KINGAKU")
            SEISAN_ZEIGAKU.Value = .Item("SEISAN_ZEIGAKU")
            SEISAN_ZEIKOMI.Value = .Item("SEISAN_ZEIKOMI")
            HACCHU_KINGAKU.Value = .Item("HACCHU_KINGAKU")
            HACCHU_ZEIGAKU.Value = .Item("HACCHU_ZEIGAKU")
            HACCHU_ZEIKOMI.Value = .Item("HACCHU_ZEIKOMI")
            TEISHUTU_DT.Value = Util.DateToSql(.Item("TEISHUTU_DT"))
            TEISHUTU_EMP_CD.Value = .Item("TEISHUTU_EMP_CD")
            TEISHUTU_EMP_NM.Value = .Item("TEISHUTU_EMP_NM")
            SHODAKU_DT.Value = Util.DateToSql(.Item("SHODAKU_DT"))
            SHODAKU_EMP_CD.Value = .Item("SHODAKU_EMP_CD")
            SHODAKU_EMP_NM.Value = .Item("SHODAKU_EMP_NM")
            SEIKYU_DT.Value = Util.DateToSql(.Item("SEIKYU_DT"))
            SEIKYU_EMP_CD.Value = .Item("SEIKYU_EMP_CD")
            SEIKYU_EMP_NM.Value = .Item("SEIKYU_EMP_NM")
            KAISHU_NO.Value = .Item("KAISHU_NO")
            KAISHU_KAISU.Value = .Item("KAISHU_KAISU")
            KAISHU_EMP_CD.Value = .Item("KAISHU_EMP_CD")
            KAISHU_EMP_NM.Value = .Item("KAISHU_EMP_NM")
            SHONIN_EMP_CD.Value = .Item("SHONIN_EMP_CD")
            SHONIN_EMP_NM.Value = .Item("SHONIN_EMP_NM")
            MITUMORI_BIKO.Value = .Item("MITUMORI_BIKO")
            SIWAKE_DT.Value = Util.DateToSql(.Item("SIWAKE_DT"))
            DENPYO_NO.Value = .Item("DENPYO_NO")
        End With

        parameters(0) = ENT_EMP_CD              '登録担当者CD
        parameters(1) = ENT_TMS                 '登録日時
        parameters(2) = ENT_PGID                '登録プログラムID
        parameters(3) = KOJI_NO                 '工事No.
        parameters(4) = MITUMORI_NO             '見積NO.
        parameters(5) = SEIKYUSAKI_SHUBETU      '請求先種別
        parameters(6) = SEIKYUSAKI_SHUBETU_NM   '請求先種別名称
        parameters(7) = CUSTOMER_CD             '顧客CD
        parameters(8) = CUSTOMER_NM             '顧客名
        parameters(9) = SEISAN_KINGAKU          '請求額(税抜)
        parameters(10) = SEISAN_ZEIGAKU         '請求額(税)
        parameters(11) = SEISAN_ZEIKOMI         '請求額(税込)
        parameters(12) = HACCHU_KINGAKU         '発注額(税抜)
        parameters(13) = HACCHU_ZEIGAKU         '発注額(税)
        parameters(14) = HACCHU_ZEIKOMI         '発注額(税込)
        parameters(15) = TEISHUTU_DT            '見積提出日
        parameters(16) = TEISHUTU_EMP_CD        '見積提出担当者CD
        parameters(17) = TEISHUTU_EMP_NM        '見積提出担当者名
        parameters(18) = SHODAKU_DT             '見積承諾日
        parameters(19) = SHODAKU_EMP_CD         '見積承諾担当者CD
        parameters(20) = SHODAKU_EMP_NM         '見積承諾担当者名
        parameters(21) = SEIKYU_DT              '請求日
        parameters(22) = SEIKYU_EMP_CD          '請求担当者CD
        parameters(23) = SEIKYU_EMP_NM          '請求担当者名
        parameters(24) = KAISHU_NO              '回収No.
        parameters(25) = KAISHU_KAISU           '回収回数
        parameters(26) = KAISHU_EMP_CD          '回収担当者CD
        parameters(27) = KAISHU_EMP_NM          '回収担当者名
        parameters(28) = SHONIN_EMP_CD          '回収承認担当者CD
        parameters(29) = SHONIN_EMP_NM          '回収承認担当者名
        parameters(30) = MITUMORI_BIKO          '見積書備考
        parameters(31) = SIWAKE_DT              '仕訳日
        parameters(32) = DENPYO_NO              '伝票No.
        Return parameters
    End Function

    ''' <summary>
    ''' 発注データのパラメータをセット
    ''' </summary>
    ''' <remarks></remarks>
    Private Function HacchusakiParameterByInsert(ByVal drHacchusaki As DataRow) As OracleParameter()
        Dim parameters(29) As OracleParameter

        Dim ENT_EMP_CD As New OracleParameter("ENT_EMP_CD", OracleDbType.Varchar2, 10)                  '発注先進捗．登録社員CD（非表示列）
        Dim ENT_TMS As New OracleParameter("ENT_TMS", OracleDbType.Varchar2, 17)                        '発注先進捗．登録日時（非表示列
        Dim ENT_PGID As New OracleParameter("ENT_PGID", OracleDbType.Varchar2, 6)                       '発注先進捗．登録プログラムID（非表示列）
        Dim KOJI_NO As New OracleParameter("KOJI_NO", OracleDbType.Varchar2, 10)                        '工事NO. 
        Dim MITUMORI_NO As New OracleParameter("MITUMORI_NO", OracleDbType.Int16, 3)                    '見積番号
        Dim HACCHU_GYOSHA_CD As New OracleParameter("HACCHU_GYOSHA_CD", OracleDbType.Varchar2, 10)      '発注業者CD
        Dim HACCHU_GYOSHA_NM As New OracleParameter("HACCHU_GYOSHA_NM", OracleDbType.Varchar2, 50)      '発注業者名
        Dim HACCHU_KINGAKU As New OracleParameter("HACCHU_KINGAKU", OracleDbType.Decimal)               '発注額(税抜)
        Dim HACCHU_ZEIGAKU As New OracleParameter("HACCHU_ZEIGAKU", OracleDbType.Decimal)               '発注額(税)
        Dim HACCHU_ZEIKOMI As New OracleParameter("HACCHU_ZEIKOMI", OracleDbType.Decimal)               '発注額(税込)
        Dim HACCHU_DT As New OracleParameter("HACCHU_DT", OracleDbType.Date)                            '発注先進捗．発注日
        Dim HACCHU_EMP_CD As New OracleParameter("HACCHU_EMP_CD", OracleDbType.Varchar2, 10)            '発注担当者CD
        Dim HACCHU_EMP_NM As New OracleParameter("HACCHU_EMP_NM", OracleDbType.Varchar2, 50)            '発注担当者名
        Dim KANRYO_YT_DT As New OracleParameter("KANRYO_YT_DT", OracleDbType.Date)                      '発注先進捗．完了予定日
        Dim KANRYO_YT_EMP_CD As New OracleParameter("KANRYO_YT_EMP_CD", OracleDbType.Varchar2, 10)      '完了予定担当者CD
        Dim KANRYO_YT_EMP_NM As New OracleParameter("KANRYO_YT_EMP_NM", OracleDbType.Varchar2, 50)      '完了予定担当者名
        Dim KANRYO_DT As New OracleParameter("KANRYO_DT", OracleDbType.Date)                            '発注先進捗．工事完了日
        Dim KANRYO_EMP_CD As New OracleParameter("KANRYO_EMP_CD", OracleDbType.Varchar2, 10)            '完了担当者CD
        Dim KANRYO_EMP_NM As New OracleParameter("KANRYO_EMP_NM", OracleDbType.Varchar2, 50)            '完了担当者名
        Dim SIHARAI_YT_DT As New OracleParameter("SIHARAI_YT_DT", OracleDbType.Date)                    '発注先進捗．支払予定日
        Dim SIHARAI_YT_EMP_CD As New OracleParameter("SIHARAI_YT_EMP_CD", OracleDbType.Varchar2, 10)    '支払予定担当者CD
        Dim SIHARAI_YT_EMP_NM As New OracleParameter("SIHARAI_YT_EMP_NM", OracleDbType.Varchar2, 50)    '支払予定担当者名
        Dim SIHARAI_DT As New OracleParameter("SIHARAI_DT", OracleDbType.Date)                          '発注先進捗．支払日
        Dim SIHARAI_EMP_CD As New OracleParameter("SIHARAI_EMP_CD", OracleDbType.Varchar2, 10)          '支払担当者CD
        Dim SIHARAI_EMP_NM As New OracleParameter("SIHARAI_EMP_NM", OracleDbType.Varchar2, 50)          '支払担当者名
        Dim HACCHU_BIKO As New OracleParameter("HACCHU_BIKO", OracleDbType.Varchar2, 200)               '発注書備考
        Dim HACCHU_PRINT_FG As New OracleParameter("HACCHU_PRINT_FG", OracleDbType.Int16, 1)            '発注書印刷フラグ（非表示）
        Dim SIHARAI_FB_NO As New OracleParameter("SIHARAI_FB_NO", OracleDbType.Varchar2, 10)            '業者支払FBNo.（非表示）
        Dim SIWAKE_DT As New OracleParameter("SIWAKE_DT", OracleDbType.Date)                            '仕訳日
        Dim DENPYO_NO As New OracleParameter("DENPYO_NO", OracleDbType.Varchar2, 10)                    '伝票No.

        With drHacchusaki
            ENT_EMP_CD.Value = .Item("ENT_EMP_CD")
            ENT_TMS.Value = .Item("ENT_TMS")
            ENT_PGID.Value = .Item("ENT_PGID")
            KOJI_NO.Value = .Item("KOJI_NO")
            MITUMORI_NO.Value = .Item("MITUMORI_NO")
            HACCHU_GYOSHA_CD.Value = .Item("HACCHU_GYOSHA_CD")
            HACCHU_GYOSHA_NM.Value = .Item("HACCHU_GYOSHA_NM")
            HACCHU_KINGAKU.Value = .Item("HACCHU_KINGAKU")
            HACCHU_ZEIGAKU.Value = .Item("HACCHU_ZEIGAKU")
            HACCHU_ZEIKOMI.Value = .Item("HACCHU_ZEIKOMI")
            HACCHU_DT.Value = Util.DateToSql(.Item("HACCHU_DT"))
            HACCHU_EMP_CD.Value = .Item("HACCHU_EMP_CD")
            HACCHU_EMP_NM.Value = .Item("HACCHU_EMP_NM")
            KANRYO_YT_DT.Value = Util.DateToSql(.Item("KANRYO_YT_DT"))
            KANRYO_YT_EMP_CD.Value = .Item("KANRYO_YT_EMP_CD")
            KANRYO_YT_EMP_NM.Value = .Item("KANRYO_YT_EMP_NM")
            KANRYO_DT.Value = Util.DateToSql(.Item("KANRYO_DT"))
            KANRYO_EMP_CD.Value = .Item("KANRYO_EMP_CD")
            KANRYO_EMP_NM.Value = .Item("KANRYO_EMP_NM")
            SIHARAI_YT_DT.Value = Util.DateToSql(.Item("SIHARAI_YT_DT"))
            SIHARAI_YT_EMP_CD.Value = .Item("SIHARAI_YT_EMP_CD")
            SIHARAI_YT_EMP_NM.Value = .Item("SIHARAI_YT_EMP_NM")
            SIHARAI_DT.Value = Util.DateToSql(.Item("SIHARAI_DT"))
            SIHARAI_EMP_CD.Value = .Item("SIHARAI_EMP_CD")
            SIHARAI_EMP_NM.Value = .Item("SIHARAI_EMP_NM")
            HACCHU_BIKO.Value = .Item("HACCHU_BIKO")
            HACCHU_PRINT_FG.Value = .Item("HACCHU_PRINT_FG")
            SIHARAI_FB_NO.Value = .Item("SIHARAI_FB_NO")
            SIWAKE_DT.Value = Util.DateToSql(.Item("SIWAKE_DT"))
            DENPYO_NO.Value = .Item("DENPYO_NO")
        End With

        parameters(0) = ENT_EMP_CD
        parameters(1) = ENT_TMS
        parameters(2) = ENT_PGID
        parameters(3) = KOJI_NO
        parameters(4) = MITUMORI_NO
        parameters(5) = HACCHU_GYOSHA_CD
        parameters(6) = HACCHU_GYOSHA_NM
        parameters(7) = HACCHU_KINGAKU
        parameters(8) = HACCHU_ZEIGAKU
        parameters(9) = HACCHU_ZEIKOMI
        parameters(10) = HACCHU_DT
        parameters(11) = HACCHU_EMP_CD
        parameters(12) = HACCHU_EMP_NM
        parameters(13) = KANRYO_YT_DT
        parameters(14) = KANRYO_YT_EMP_CD
        parameters(15) = KANRYO_YT_EMP_NM
        parameters(16) = KANRYO_DT
        parameters(17) = KANRYO_EMP_CD
        parameters(18) = KANRYO_EMP_NM
        parameters(19) = SIHARAI_YT_DT
        parameters(20) = SIHARAI_YT_EMP_CD
        parameters(21) = SIHARAI_YT_EMP_NM
        parameters(22) = SIHARAI_DT
        parameters(23) = SIHARAI_EMP_CD
        parameters(24) = SIHARAI_EMP_NM
        parameters(25) = HACCHU_BIKO
        parameters(26) = HACCHU_PRINT_FG
        parameters(27) = SIHARAI_FB_NO
        parameters(28) = SIWAKE_DT
        parameters(29) = DENPYO_NO
        Return parameters
    End Function

    ''' <summary>
    ''' 見積データのパラメータをセット
    ''' </summary>
    ''' <remarks></remarks>
    Private Function MitumoriParametersByInsert(ByVal drMitumori As DataRow) As OracleParameter()
        Dim parameters(23) As OracleParameter

        Dim ROWID_ANKEN As New OracleParameter("ROWID_ANKEN", OracleDbType.Varchar2, 18)            '工事案件データROWID
        Dim ROWID_MITUMORI As New OracleParameter("ROWID_MITUMORI", OracleDbType.Varchar2, 18)      '見積データROWID			
        Dim LAST_EMP_NM As New OracleParameter("LAST_EMP_NM", OracleDbType.Varchar2, 50)            '最終更新担当者
        Dim LAST_TMS As New OracleParameter("LAST_TMS", OracleDbType.Varchar2, 17)                  '最終更新日
        Dim KOJI_NO As New OracleParameter("KOJI_NO", OracleDbType.Varchar2, 10)                    '工事No.
        Dim MITUMORI_NO As New OracleParameter("MITUMORI_NO", OracleDbType.Int16, 3)                '見積NO.
        Dim MITUMORI_NM As New OracleParameter("MITUMORI_NM", OracleDbType.Varchar2, 50)            '見積名
        Dim MITUMORI_ST As New OracleParameter("MITUMORI_ST", OracleDbType.Varchar2, 2)             '見積状態
        Dim MITUMORI_ST_NM As New OracleParameter("MITUMORI_ST_NM", OracleDbType.Varchar2, 40)      '見積状態名称
        Dim TUIKA_KOJI_FG As New OracleParameter("TUIKA_KOJI_FG", OracleDbType.Int16, 1)            '追加工事フラグ
        Dim TUIKA_KOJI_JIYU As New OracleParameter("TUIKA_KOJI_JIYU", OracleDbType.Varchar2, 50)    '追加工事事由
        Dim KOJI_CHUSI_FG As New OracleParameter("KOJI_CHUSI_FG", OracleDbType.Int16, 1)            '工事中止フラグ
        Dim KOJI_CHUSI_JIYU As New OracleParameter("KOJI_CHUSI_JIYU", OracleDbType.Varchar2, 50)    '工事中止事由
        Dim MITUMORI_DT As New OracleParameter("MITUMORI_DT", OracleDbType.Date)                    '見積日
        Dim MITUMORI_EMP_CD As New OracleParameter("MITUMORI_EMP_CD", OracleDbType.Varchar2, 10)    '見積担当者CD
        Dim MITUMORI_EMP_NM As New OracleParameter("MITUMORI_EMP_NM", OracleDbType.Varchar2, 50)    '見積担当者名
        Dim HOKOKU_DT As New OracleParameter("HOKOKU_DT", OracleDbType.Date)                        '報告日
        Dim SINSEI_DT As New OracleParameter("SINSEI_DT", OracleDbType.Date)                        '承認申請日
        Dim SINSEI_EMP_CD As New OracleParameter("SINSEI_EMP_CD", OracleDbType.Varchar2, 10)        '承認申請担当者CD
        Dim SINSEI_EMP_NM As New OracleParameter("SINSEI_EMP_NM", OracleDbType.Varchar2, 50)        '承認申請担当者名
        Dim SHONIN_DT As New OracleParameter("SHONIN_DT", OracleDbType.Date)                        '発注承認日
        Dim SHONIN_EMP_CD As New OracleParameter("SHONIN_EMP_CD", OracleDbType.Varchar2, 10)        '発注承認担当者CD
        Dim SHONIN_EMP_NM As New OracleParameter("SHONIN_EMP_NM", OracleDbType.Varchar2, 50)        '発注承認担当者名
        Dim DAIITI_FG As New OracleParameter("DAIITI_FG", OracleDbType.Int16, 1)                    '第一見積フラグ


        With drMitumori
            ROWID_ANKEN.Value = .Item("ROWID_ANKEN")
            ROWID_MITUMORI.Value = .Item("ROWID_MITUMORI")
            LAST_EMP_NM.Value = .Item("LAST_EMP_NM")
            LAST_TMS.Value = .Item("LAST_TMS")
            KOJI_NO.Value = .Item("KOJI_NO")
            MITUMORI_NO.Value = .Item("MITUMORI_NO")
            MITUMORI_NM.Value = .Item("MITUMORI_NM")
            MITUMORI_ST.Value = .Item("MITUMORI_ST")
            MITUMORI_ST_NM.Value = .Item("MITUMORI_ST_NM")
            TUIKA_KOJI_FG.Value = .Item("TUIKA_KOJI_FG")
            TUIKA_KOJI_JIYU.Value = .Item("TUIKA_KOJI_JIYU")
            KOJI_CHUSI_FG.Value = .Item("KOJI_CHUSI_FG")
            KOJI_CHUSI_JIYU.Value = .Item("KOJI_CHUSI_JIYU")
            MITUMORI_DT.Value = Util.DateToSql(.Item("MITUMORI_DT"))
            MITUMORI_EMP_CD.Value = .Item("MITUMORI_EMP_CD")
            MITUMORI_EMP_NM.Value = .Item("MITUMORI_EMP_NM")
            HOKOKU_DT.Value = Util.DateToSql(.Item("HOKOKU_DT"))
            SINSEI_DT.Value = Util.DateToSql(.Item("SINSEI_DT"))
            SINSEI_EMP_CD.Value = .Item("SINSEI_EMP_CD")
            SINSEI_EMP_NM.Value = .Item("SINSEI_EMP_NM")
            SHONIN_DT.Value = Util.DateToSql(.Item("SHONIN_DT"))
            SHONIN_EMP_CD.Value = .Item("SHONIN_EMP_CD")
            SHONIN_EMP_NM.Value = .Item("SHONIN_EMP_NM")
            DAIITI_FG.Value = .Item("DAIITI_FG")
        End With

        parameters(0) = ROWID_ANKEN
        parameters(1) = ROWID_MITUMORI
        parameters(2) = LAST_EMP_NM
        parameters(3) = LAST_TMS
        parameters(4) = KOJI_NO
        parameters(5) = MITUMORI_NO
        parameters(6) = MITUMORI_NM
        parameters(7) = MITUMORI_ST
        parameters(8) = MITUMORI_ST_NM
        parameters(9) = TUIKA_KOJI_FG
        parameters(10) = TUIKA_KOJI_JIYU
        parameters(11) = KOJI_CHUSI_FG
        parameters(12) = KOJI_CHUSI_JIYU
        parameters(13) = MITUMORI_DT
        parameters(14) = MITUMORI_EMP_CD
        parameters(15) = MITUMORI_EMP_NM
        parameters(16) = HOKOKU_DT
        parameters(17) = SINSEI_DT
        parameters(18) = SINSEI_EMP_CD
        parameters(19) = SINSEI_EMP_NM
        parameters(20) = SHONIN_DT
        parameters(21) = SHONIN_EMP_CD
        parameters(22) = SHONIN_EMP_NM
        parameters(23) = DAIITI_FG
        Return parameters
    End Function

    ''' <summary>
    ''' 請求割合についてのSQL文
    ''' </summary>
    ''' <remarks></remarks>
    Private Function INSERT_INTO_SEIKYU_WARIAI()
        Dim insertSql As StringBuilder = New StringBuilder

        insertSql.AppendLine("INSERT INTO ")
        insertSql.AppendLine("T_KJ0020T7(")
        insertSql.AppendLine("              KOJI_NO,")              '工事NO.
        insertSql.AppendLine("              MITUMORI_NO,")          '見積番号
        insertSql.AppendLine("              HACCHU_GYOSHA_CD,")     '発注業者CD
        insertSql.AppendLine("              HACCHU_GYOSHA_NM,")     '発注業者名
        insertSql.AppendLine("              ROW_NO,")               '行No.
        insertSql.AppendLine("              SEIKYUSAKI_SHUBETU,")   '請求先種別
        insertSql.AppendLine("              CUSTOMER_CD,")          '顧客CD
        insertSql.AppendLine("              CUSTOMER_NM,")          '顧客名
        insertSql.AppendLine("              FUTAN_WARIAI,")         '見積明細.請求先・割合()
        insertSql.AppendLine("              KINGAKU,")              '見積明細.請求先・発注税抜()
        insertSql.AppendLine("              GENKA_KINGAKU)")        '見積明細.請求先・精算税抜()
        insertSql.AppendLine("VALUES(")
        insertSql.AppendLine("              :KOJI_NO,")              '工事NO.
        insertSql.AppendLine("              :MITUMORI_NO,")          '見積番号
        insertSql.AppendLine("              :HACCHU_GYOSHA_CD,")     '発注業者CD
        insertSql.AppendLine("              :HACCHU_GYOSHA_NM,")     '発注業者名
        insertSql.AppendLine("              :ROW_NO,")               '行No.
        insertSql.AppendLine("              :SEIKYUSAKI_SHUBETU,")   '請求先種別
        insertSql.AppendLine("              :CUSTOMER_CD,")          '顧客CD
        insertSql.AppendLine("              :CUSTOMER_NM,")          '顧客名
        insertSql.AppendLine("              :FUTAN_WARIAI,")         '見積明細.請求先・割合()
        insertSql.AppendLine("              :KINGAKU,")              '見積明細.請求先・発注税抜()
        insertSql.AppendLine("              :GENKA_KINGAKU)")        '見積明細.請求先・精算税抜()

        Return insertSql
    End Function

    ''' <summary>
    ''' 請求割合のパラメータをセット
    ''' </summary>
    ''' <remarks></remarks>
    Private Function SeikyuwariaiParametersByInsert(ByVal drSerikyuwariai As DataRow) As OracleParameter()
        Dim parameters(10) As OracleParameter

        Dim KOJI_NO As New OracleParameter("KOJI_NO", OracleDbType.Varchar2)                        '工事NO.
        Dim MITUMORI_NO As New OracleParameter("MITUMORI_NO", OracleDbType.Int16)                   '見積番号
        Dim HACCHU_GYOSHA_CD As New OracleParameter("HACCHU_GYOSHA_CD", OracleDbType.Varchar2)      '発注業者CD
        Dim HACCHU_GYOSHA_NM As New OracleParameter("HACCHU_GYOSHA_NM", OracleDbType.Varchar2)      '発注業者名
        Dim ROW_NO As New OracleParameter("ROW_NO", OracleDbType.Int16)                             '行No.
        Dim SEIKYUSAKI_SHUBETU As New OracleParameter("SEIKYUSAKI_SHUBETU", OracleDbType.Varchar2)  '請求先種別
        Dim CUSTOMER_CD As New OracleParameter("CUSTOMER_CD", OracleDbType.Varchar2)                '顧客CD
        Dim CUSTOMER_NM As New OracleParameter("CUSTOMER_NM", OracleDbType.Varchar2)                '顧客名
        Dim FUTAN_WARIAI As New OracleParameter("FUTAN_WARIAI", OracleDbType.Decimal)               '見積明細.請求先・割合()
        Dim KINGAKU As New OracleParameter("KINGAKU", OracleDbType.Decimal)                         '見積明細.請求先・発注税抜()
        Dim GENKA_KINGAKU As New OracleParameter("GENKA_KINGAKU", OracleDbType.Decimal)             '見積明細.請求先・精算税抜()

        With drSerikyuwariai
            KOJI_NO.Value = drSerikyuwariai("KOJI_NO")                          '工事NO.
            MITUMORI_NO.Value = drSerikyuwariai("MITUMORI_NO")                  '見積番号
            HACCHU_GYOSHA_CD.Value = drSerikyuwariai("HACCHU_GYOSHA_CD")        '発注業者CD
            HACCHU_GYOSHA_NM.Value = drSerikyuwariai("HACCHU_GYOSHA_NM")        '発注業者名
            ROW_NO.Value = drSerikyuwariai("ROW_NO")                            '行No.
            SEIKYUSAKI_SHUBETU.Value = drSerikyuwariai("SEIKYUSAKI_SHUBETU")    '請求先種別
            CUSTOMER_CD.Value = drSerikyuwariai("CUSTOMER_CD")                  '顧客CD
            CUSTOMER_NM.Value = drSerikyuwariai("CUSTOMER_NM")                  '顧客名
            FUTAN_WARIAI.Value = drSerikyuwariai("FUTAN_WARIAI")                '見積明細.請求先・割合()
            KINGAKU.Value = drSerikyuwariai("KINGAKU")                          '見積明細.請求先・発注税抜()
            GENKA_KINGAKU.Value = drSerikyuwariai("GENKA_KINGAKU")              '見積明細.請求先・精算税抜()
        End With

        parameters(0) = KOJI_NO             '工事NO.
        parameters(1) = MITUMORI_NO         '見積番号
        parameters(2) = HACCHU_GYOSHA_CD    '発注業者CD
        parameters(3) = HACCHU_GYOSHA_NM    '発注業者名
        parameters(4) = ROW_NO              '行No.
        parameters(5) = SEIKYUSAKI_SHUBETU  '請求先種別
        parameters(6) = CUSTOMER_CD         '顧客CD
        parameters(7) = CUSTOMER_NM         '顧客名
        parameters(8) = FUTAN_WARIAI        '見積明細.請求先・割合()
        parameters(9) = KINGAKU            '見積明細.請求先・発注税抜()
        parameters(10) = GENKA_KINGAKU      '見積明細.請求先・精算税抜()


        Return parameters
    End Function
End Class


